package com.kymatrix.kycarbon.xsmd.system.server.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kymatrix.kycarbon.xsmd.common.business.common.BaseTenantEntity;
import com.kymatrix.kycarbon.xsmd.common.enums.EnableTypeEnum;
import com.kymatrix.kycarbon.xsmd.system.api.dto.UserDto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * @author jiechen
 * @since 2023/8/10 21:55
 */
@TableName("t_sys_user")
@SuperBuilder
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
public class UserEntity extends BaseTenantEntity {

    @TableField("username")
    String username;

    @TableField("password")
    String password;

    @TableField("phone")
    String phone;

    @TableField("email")
    String email;
    
    
    public UserDto toDto() {
        UserDto userDto = new UserDto();
        userDto.setId(this.getId());
        userDto.setNickname(this.getUsername());
        userDto.setStatus(EnableTypeEnum.ENABLE.getCode());
        userDto.setMobile(this.getPhone());
        return userDto;
    }


}
